<template>
  <div class="detail-header">
    <!-- 头部 返回按钮 -->
    <div class="detail-header-1">
      <van-icon name="arrow-left" @click="$router.back()" />
    </div>

    <!-- 头部 导航按钮 -->
    <div class="detail-header-2">
      <div class="detail-header-2-box" v-for="item in list" :key="item" @click="aaa(item)">
        <p class="y1">{{ item }}</p>
        <div class="y2" ref="yyy" v-bind:class="{ active: ih === item }"></div>
      </div>
    </div>

    <!-- 头部 选项按钮 -->
    <div class="detail-header-3">
      <van-icon name="ellipsis" />
    </div>
  </div>
</template>

<script lang="ts" setup>
const list = ref(['商品'])

const ih = ref('商品')

function aaa(key: string) {
  ih.value = key
}
</script>

<style scoped>
.active {
  display: block !important;
}
.y1 {
  margin: auto;
  font-size: 13px;
  color: #262626;
  text-align: center;
  position: absolute;
  line-height: 44px;
  margin-left: 15px;
  font-size:20px ;
}
.y2 {
  width: 28px;
  height: 3px;
  background-color: red;
  background-image: linear-gradient(90deg, #f5503a, #fad1cb);
  position: absolute;
  bottom: 6px;
  left: 25%;
  display: none;
}
.detail-header {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  position: relative;
}
.detail-header-1 {
  width: 40px;
  line-height: 44px;
  text-align: center;
  box-sizing: border-box;
}
.detail-header-2 {
  height: 100%;
  display: flex;
  font-size: 20px;
}
.detail-header-2-box {
  width: 58px;
  height: 44px;
  position: relative;
}
.detail-header-3 {
  width: 40px;
  line-height: 46px;
  text-align: center;
  box-sizing: border-box;
}
</style>
